import { ApiProperty } from '@nestjs/swagger';
import { Type } from 'class-transformer';
import { IsOptional, IsString, Max, Min } from 'class-validator';

export class NameTakeReqDto {
  @ApiProperty({ description: '名称', required: false })
  @IsString({ message: '名称格式不正确' })
  @IsOptional()
  readonly name: string;

  @ApiProperty({ description: '获取数量5~100' })
  @Type(() => Number)
  @Max(100, { message: '数量值不能大于100' })
  @Min(5, { message: '数量值不能小于5' })
  readonly take: number;
}
